<?php

/**
 * @author Sonnk
 * @copyright 2011
 */
class incMenu extends CI_Include {

    function __construct() {
        parent::__construct();
        $this->load->incModel();

        $login = $this->load->pub->GetSession("login");

        if (isset($login->username)) {
            $data = '<div class="imguser"></div>       
            <div class="infouser" style="display: none; position: relative; z-index: 999">
            <div class="gb_E"></div>
            <div class="gb_D"></div>
            <div class="gb_o" style="width: auto; height: auto; padding: 10px">                
                <a href="#">Thông tin cá nhân</a> 
                <a href="#">Tin đã đăng</a> 
                <a href="'.base_url().'authorize/logout">Đăng xuất</a>                                  
            </div>
            </div>';
        } else {
            $data = '<ul id="nav">          
                    <li><a href="' . base_url() . 'authorize">Đăng nhập</a>      
                    </li>    
                     <li><a href="' . base_url() . 'register">Đăng ký</a>      
                    </li>  
                  </ul>';
        }
        $this->load->incView($data);
    }
    
    
    function logout() {
        $this->pub->DeleteSession("login");        
        //redirect(base_url());
    }

}
